/******************************************************************************
 * Copyright (C) 671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef NODECPP_FOUNDATION_STRING_H_
#define NODECPP_FOUNDATION_STRING_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <cstdarg>
#include <string>
#include <vector>
#include <cstdio>

namespace NodeCpp
{
    int snprintf(char *_Dest, int _Size, const char *_Format, ...);
    int vsnprintf(char *_Dest, int _Size, const char *_Format, std::va_list _Args);

    int vfprintf(FILE * _File, const char * _Format, std::va_list _Args);

    char *itoa(int _Val, char *_Buf, std::size_t _Size, int _Radix);
    char *ltoa(long _Val, char *_Buf, std::size_t _Size, int _Radix);

    typedef std::vector< std::string >    Tokens;
    Tokens StrSplit(const std::string& _Src, const std::string& _Sep);
    void TrimString(std::string& _Src, const std::string &_Trim);

    int strcasecmp(const char* _Str1, const char* _Str2);

    void ToUpper(std::string& _Str);
    void ToLower(std::string& _Str);
}

#endif // NODECPP_FOUNDATION_STRING_H_
